<?php
using("Utils_ResourceManager");

class Tests_Utils_ResourceManager extends UnitTestCase {
	
	/**
	 * Resource package handler
	 *
	 * @var Utils_ResourceManager
	 */
	private $_resource;
	
	public function testConstruct() {
		try {
			$this->_resource = new Utils_ResourceManager("TestDummy");
			$this->assertTrue(is_a($this->_resource, "Utils_ResourceManager"));
			
			$this->_resource = new Utils_ResourceManager(new TestDummy());
		} catch (Exception $e) {
			$this->assertTrue(false);
		}
	}
	
	public function testGetString() {
		$this->assertTrue($this->_resource->getString("foo") == "bar");
		$this->assertTrue($this->_resource->getString("bar") == "foo");
		$this->assertTrue($this->_resource->getString("hello") == "world");
	}
	
	public function testIterator() {
		try {
			foreach ($this->_resource as $key) {
				$test .= $this->_resource->getString($key);
			}
			$this->assertTrue($test == "barfooworld");
		} catch (Exception $e) {
			$this->assertTrue(false);
		}
	}
}

class TestDummy {
	// no contents
}
?>